# coding=utf-8
import numpy as np


def dot(weights, x):
    """
    过期
    对两个列表进行矩阵乘法计算（点乘）
    :param weights: 权重
    :param x: 输入
    :return: 
    """
    # weights_matrix = mat(weights)
    # x_matrix = mat(x)
    result_list = np.multiply(weights, x)
    result = 0
    for ele in result_list:
        result += ele
    return result


def sgn_function(result):
    """
    过期
    取符号函数
    :param result: 
    :return: 
    """
    return 1 if result >= 0 else -1


def output(weights, bias, x):
    """
    计算神经元输出
    :param weights: 权重
    :param bias: 偏置
    :param x: 输入
    :return: 
    """
    result = np.dot(weights, x) + bias
    print result
    return np.sign(result)


if __name__ == '__main__':
    weights_parm = [1, 2]
    x_param = [2, 3]
    bias_param = 1
    print output(weights_parm, bias_param, x_param)
